package com.src.java.multithreading.lock;

public class Philospher implements Runnable {
	private Fork leftFork, rightFork;

	Philospher(Fork a, Fork b) {
		this.leftFork = a;
		this.rightFork = b;
	}

	public void run() {
		while (true) {
			// eating
			leftFork.eating();
			rightFork.eating();
			try {
				Thread.sleep(2000);
			} catch (Exception exc) {
				System.out.println("Exception found...");
			}
			// thinking
			rightFork.thinking();
			leftFork.thinking();
		}
	}

}
